package ccnt.pvc.scudwaremobile.service;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;

public class MiddlewareServiceConnection<T extends Binder> implements ServiceConnection {

	private boolean isBound = false;
	private T binder = null;
	
	@SuppressWarnings("unchecked")
	@Override
	public void onServiceConnected(ComponentName name, IBinder service) {
		isBound = true;
		binder = (T)service;
	}

	@Override
	public void onServiceDisconnected(ComponentName name) {
		isBound = false;
		binder = null;
	}

	public boolean isBound() {
		return isBound;
	}

	public void setBound(boolean isBound) {
		this.isBound = isBound;
	}

	public T getBinder() {
		return binder;
	}

	public void setBinder(T binder) {
		this.binder = binder;
	}
	
}
